const fl={
	fx: 'display:flex;',
	fy: 'display:flex;flex-direction:column;',
	s: 'flex-start',
	e: 'flex-end',
	c: 'center',
	sc: 'stretch',
	bl: 'baseline',
	1: 'space-between',
	3: 'space-evenly',
	4: 'space-around'
}
let Re = /(fx|fy|fsx|fsy)([sce134])?(x|y)?([sce134])?/g
const flex = (str, re)=>{
	let arrClass = str.match(Re)
	if (arrClass === null) return ''
	return arrClass.join('\n').replace(Re, (...argv)=>{
		let [a,b,c='s',d,e='s'] = argv
		let re = /fs[xy]/g
		let [jc,ac,ai] = ['justify-content:','align-content:','align-items:']
		if(re.test(a)){
			return `.${a}{${fl[b]}${fl[c]};${jc+fl[e]};}`
		}else{
			return `.${a}{${fl[b]}${jc+fl[c]};${d?''+ai+fl[e]+';':''}}`
		}
		
	})
}

module.exports = flex